package co.edu.javeriana.monopoly.client.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

import co.edu.javeriana.monopoly.client.Cliente;
import co.edu.javeriana.monopoly.model.IPropiedad;
import co.edu.javeriana.monopoly.model.Propiedad;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GUI_Client.java
 *
 * Created on 23/05/2009, 11:17:11 PM
 */
/**
 * This code was edited or generated using CloudGarden's Jigloo
 * SWT/Swing GUI Builder, which is free for non-commercial
 * use. If Jigloo is being used commercially (ie, by a corporation,
 * company or business for any purpose whatever) then you
 * should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details.
 * Use of Jigloo implies acceptance of these licensing terms.
 * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
 * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
 * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
/**
 *
 * @author Lhy
 */
public class GUI_Client extends JFrame {

    private Cliente cliente;

    /** Creates new form GUI_Client */
    public GUI_Client(Cliente cliente) {
        initComponents();
        //this.llenarPropiedades();
        this.iniciarTablero();
        this.cliente = cliente;
    }

    public void llenarPropiedades() {
        int x = 55, y = 110;
        int direction;
        ImageIcon image;
        direction = PropiedadPanel.VERTICAL;
        Color zone = IPropiedad.ZONE2;
        IPropiedad prop = new Propiedad();
        prop.setZone(zone);
        String nombre = "Leticia";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setImage(image);
        PropiedadPanel p = new PropiedadPanel(prop, x, y, direction, image);
        this.inferior.add(p, 0);
        prop = new Propiedad();
        nombre = "Chest";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".gif"));
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.inferior.add(p, 0);
        prop = new Propiedad();
        nombre = "Yopal";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.inferior.add(p, 0);
        prop = new Propiedad();
        nombre = "Tax";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.inferior.add(p, 0);
        prop = new Propiedad();
        nombre = "Aeropuerto";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, x, y, direction, image);
        zone = IPropiedad.ZONE1;
        this.inferior.add(p, 0);
        prop = new Propiedad();
        prop.setZone(zone);
        nombre = "Cali";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.inferior.add(p, 0);
        prop = new Propiedad();
        nombre = "Chance";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.inferior.add(p, 0);
        prop = new Propiedad();
        nombre = "Pasto";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.inferior.add(p, 0);
        prop = new Propiedad();
        nombre = "Barranquilla";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.inferior.add(p, 0);
        /*SUPERIOR*/
        direction = PropiedadPanel.INVERSEVERTICAL;
        zone = IPropiedad.ZONE5;
        prop = new Propiedad();
        nombre = "Panaca";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.superior.add(p);
        prop = new Propiedad();
        nombre = "Chance";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.superior.add(p);
        prop = new Propiedad();
        nombre = "Cafe";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.superior.add(p);
        prop = new Propiedad();
        nombre = "Chicamocha";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.superior.add(p);

        zone = IPropiedad.ZONE6;
        prop = new Propiedad();
        nombre = "Aeropuerto";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.superior.add(p);
        prop = new Propiedad();
        nombre = "Cartagena";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.superior.add(p);
        prop = new Propiedad();
        nombre = "CaboVela";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.superior.add(p);
        prop = new Propiedad();
        nombre = "UNE";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.superior.add(p);
        prop = new Propiedad();
        nombre = "bahiaSolano";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, x, y, direction, image);
        this.superior.add(p);

        /*Izquierda*/
        direction = PropiedadPanel.INVERSEHORIZONTAL;
        zone = IPropiedad.ZONE4;
        prop = new Propiedad();
        nombre = "Barichara";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.izquierda.add(p, 0);
        prop = new Propiedad();
        nombre = "ETB";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.izquierda.add(p, 0);
        prop = new Propiedad();
        nombre = "Bucaramanga";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.izquierda.add(p, 0);
        prop = new Propiedad();
        nombre = "SierraMacarena";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.izquierda.add(p, 0);
        zone = IPropiedad.ZONE3;
        prop = new Propiedad();
        nombre = "Aeropuerto";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.izquierda.add(p, 0);
        prop = new Propiedad();
        nombre = "Quibdo";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.izquierda.add(p, 0);
        prop = new Propiedad();
        prop = new Propiedad();
        nombre = "Chest";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".gif"));
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.izquierda.add(p, 0);
        prop = new Propiedad();
        nombre = "Zipaquira";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.izquierda.add(p, 0);
        prop = new Propiedad();
        nombre = "Medellin";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.izquierda.add(p, 0);
        /*derecha*/

        direction = PropiedadPanel.HORIZONTAL;
        zone = IPropiedad.ZONE7;
        prop = new Propiedad();
         nombre = "Leticia";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.derecha.add(p);
        prop = new Propiedad();
         nombre = "Bogota1";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.derecha.add(p);
        prop = new Propiedad();
       nombre = "Chest";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".gif"));
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.derecha.add(p);
        prop = new Propiedad();
       nombre = "Nevados";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.derecha.add(p);
        prop = new Propiedad();
        nombre = "Aeropuerto";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.derecha.add(p);
        prop = new Propiedad();
        nombre = "Chance";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.derecha.add(p);
        zone = IPropiedad.ZONE8;
        prop = new Propiedad();
        nombre = "Bogota";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.derecha.add(p);
        prop = new Propiedad();
        nombre = "Tax";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.derecha.add(p);
        prop = new Propiedad();
        nombre = "Parque93";
        prop.setNombre(nombre);
        image = new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/" + nombre + ".jpg"));
        prop.setZone(zone);
        prop.setZone(zone);
        p = new PropiedadPanel(prop, y, x, direction, image);
        this.derecha.add(p);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    //@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation ( WindowConstants.EXIT_ON_CLOSE );
        setTitle ( "Monopoly" );
        setResizable ( false );

        /*javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1318, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 717, Short.MAX_VALUE)
        );
*/
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void iniciarTablero() {
        this.setSize(715, 715);
        //this.setSize(1045, 715);
        Container pane = this.getContentPane();
        GridBagLayout paneLayout = new GridBagLayout();
        pane.setLayout(paneLayout);
        GridBagConstraints constraints = new GridBagConstraints();
        constraints.fill = GridBagConstraints.NONE;
        constraints.weightx = 3.0;
        constraints.weighty = 1.0;
        tablero = new JPanel();
        tablero.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        tablero.setPreferredSize(new Dimension(715, 715));
        pane.add(tablero, constraints);
        /*constraints.weighty = 1.0;
        constraints.weightx = 1.0;
        constraints.gridwidth = GridBagConstraints.REMAINDER; //end row
        plata = new JPanel();
        plata.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        pane.add(plata, constraints);*/
        tablero.setLayout(new GridBagLayout());
        constraints = new GridBagConstraints();
        constraints.fill = GridBagConstraints.BOTH;
        constraints.weightx = 2.0;
        constraints.weighty = 2.0;
        jackpot = new JPanel();
        jackpot.setPreferredSize(new Dimension(110, 110));
        jackpot.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jackpot.setBackground(new Color(0, 0, 0));
        jackpot.setLayout(new BorderLayout(0, 0));
        tablero.add(jackpot, constraints);
        JLabel parkingLabel = new JLabel();
        jackpot.add(parkingLabel, BorderLayout.CENTER);
        parkingLabel.setIcon(new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/DocNewsNo4185DocumentNo458.JPG")));
        superior = new JPanel();
        constraints.weighty = 2.0;
        constraints.weightx = 9.0;
        constraints.gridheight = 110;
        constraints.gridwidth = 495;
        superior.setPreferredSize(new Dimension(110, 495));
        superior.setLayout(new GridLayout(1, 9, 0, 0));
        superior.setSize(new Dimension(495, 110));
        superior.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        tablero.add(superior, constraints);
        goJail = new JPanel();
        goJail.setLayout(new BorderLayout(0, 0));
        goJail.setPreferredSize(new Dimension(110, 110));
        constraints.weightx = 2.0;
        constraints.weighty = 2.0;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        goJail.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        this.goJail.setBackground(new java.awt.Color(255, 0, 255));
        tablero.add(goJail, constraints);
        JLabel gotoJailLabel = new JLabel();
        goJail.add(gotoJailLabel);
        gotoJailLabel.setIcon(new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/IrCarcel.png")));
        constraints = new GridBagConstraints();
        izquierda = new JPanel();
        constraints.fill = GridBagConstraints.BOTH;
        constraints.weightx = 2.0;
        constraints.weighty = 9.0;
        izquierda.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        izquierda.setLayout(new GridLayout(9, 1, 0, 0));
        izquierda.setPreferredSize(new Dimension(110, 495));
        tablero.add(izquierda, constraints);
        fondo = new JPanel();
        fondo.setLayout(new BorderLayout(0, 0));
        constraints.weightx = 9.0;
        constraints.weighty = 9.0;
        fondo.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        fondo.setPreferredSize(new Dimension(495, 495));
        tablero.add(fondo, constraints);
        JLabel tableroLabel = new JLabel();
        fondo.add(tableroLabel);
        tableroLabel.setIcon(new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/Tablero.jpg")));
        derecha = new JPanel();
        derecha.setLayout(new GridLayout(9, 1, 0, 0));
        derecha.setPreferredSize(new Dimension(110, 495));
        constraints.weightx = 2.0;
        constraints.weighty = 9.0;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        //derecha.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        tablero.add(derecha, constraints);
        constraints = new GridBagConstraints();
        jail = new JPanel();
        jail.setLayout(new BorderLayout(0, 0));
        constraints.fill = GridBagConstraints.BOTH;
        constraints.weightx = 2.0;
        constraints.weighty = 2.0;
        jail.setPreferredSize(new Dimension(110, 110));
        jail.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        this.jail.setBackground(new java.awt.Color(0, 0, 255));
        tablero.add(jail, constraints);
        JLabel jailLabel = new JLabel();
        jail.add(jailLabel);
        jailLabel.setIcon(new ImageIcon(getClass().getClassLoader().getResource("co/edu/javeriana/monopoly/client/images/Carcel.png")));
        inferior = new JPanel();
        constraints.weightx = 9.0;
        constraints.weighty = 2.0;
        inferior.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        inferior.setPreferredSize(new Dimension(110, 495));
        inferior.setLayout(new GridLayout(1, 9, 0, 0));
        tablero.add(inferior, constraints);
        salida = new JPanel();
        salida.setLayout(new BorderLayout(0, 0));
        constraints.weightx = 2.0;
        constraints.weighty = 2.0;
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        salida.setPreferredSize(new Dimension(110, 110));
        salida.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        this.salida.setBackground(new java.awt.Color(0, 255, 255));
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        tablero.add(salida, constraints);
        salidaLabel = new JLabel();
        salidaLabel.setIcon(new ImageIcon(getClass().getResource("/co/edu/javeriana/monopoly/client/images/inicio.jpg")));
        salida.add(salidaLabel);
        salidaLabel.setSize(110, 110);
        /*for (int i = 0; i < this.propiedades.size(); i++) {
        int aux = i / 9;
        if (aux == 0) {
        this.inferior.add(this.propiedades.get(i), 0);
        } else if (aux == 1) {
        this.superior.add(this.propiedades.get(i), 0);
        } else if (aux == 2) {
        this.izquierda.add(this.propiedades.get(i));
        } else {

        this.derecha.add(this.propiedades.get(i));
        }
        }*/
        llenarPropiedades();


    }
    JPanel tablero;
    JPanel plata;
    JPanel jackpot;
    private JLabel salidaLabel;
    JPanel superior;
    JPanel goJail;
    JPanel izquierda;
    JPanel fondo;
    JPanel derecha;
    JPanel inferior;
    JPanel jail;
    JPanel salida;
    //ArrayList<PropiedadPanel> propiedades = new ArrayList<PropiedadPanel>();

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
